<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 伪类 */
        button:active{
            background-color: red;
            color: white;
        }
        p:hover{
            background-color: yellow;
        }
        ::selection{
            background-color: blue;
            color: white;
        }
        input:focus{
            border: 2px solid blue;
            outline: none;/* 可选：移除默认轮廓 */
        }
        input:checked + label {
            font-weight: bold;
        }
        li:not(:last-child) {
            margin-bottom: 10px;
        }
        li:nth-child(odd) {
            background-color: lightgray;
        }
    </style>
</head>
<body>
  <div class="container">
    <h1>伪类选择器示例</h1>
    <button>点击我</button>
    <p>鼠标悬浮在这里</p>
    <input type="text" placeholder="输入框" autofocus>
    <input type="checkbox" id="option1">
    <label for="option1">选项1</label>
    <input type="checkbox" id="option2" checked>
    <label for="option2">选项2</label>
    <ul>
      <li>列表项1</li>
      <li>列表项2</li>
      <li>列表项3</li>
      <li>列表项4</li>
    </ul>
  </div>
</body>
</html>